package com.mx.adapt.picker

import android.content.Context
import android.util.AttributeSet
import android.widget.FrameLayout
import android.widget.TextView
import com.mx.adapt.MXBaseSimpleAdapt

open class MXStringPickerView(context: Context, attrs: AttributeSet? = null) :
    MXScrollPickerView(context, attrs) {
    val adapt = MXStringPickerAdapt()

    init {
        super.setMXAdapt(adapt)
    }

    override fun setMXAdapt(adapt: MXBaseSimpleAdapt<*>?) {
        throw Exception("Forbidden call func 'setMXAdapt()'")
    }

    fun setData(list: List<String>) {
        adapt.list.clear()
        adapt.list.addAll(list)
        adapt.notifyDataSetChanged()
    }

    fun setListItemProcess(process: ((position: Int, container: FrameLayout, textView: TextView) -> Unit)? = null) {
        adapt.itemProcess = process
        adapt.notifyDataSetChanged()
    }
}